// 车型维护
<template>
  <div class="app-container">
    <el-row style="margin-bottom: 30px;">
      <!-- <el-button type="primary" @click="handleAdd">新增</el-button> -->
    </el-row>
    <vxe-table
      border
      stripe
      ref="tableRef"
      size="small"
      header-align="center"
      :row-config="rowConfig"
      :column-config="columnConfig"
      @cell-click="cellClickEvent"
      :data="productList"
      height="1000"
    >
      <vxe-column field="itemTypeId" width="120" show-overflow="title" align="center" drag-sort title="车型ID"></vxe-column>
      <vxe-column field="itemTypeName" show-overflow="title" align="center" title="车型名称"></vxe-column>
      <vxe-column field="itemTypeCode" show-overflow="title" align="center" title="车型编号"></vxe-column>
      <vxe-column field="createTime"  show-overflow="title" align="center" title="创建时间">
        <template #default="{ row }">
          {{ row.createTime ? parseTime(row.createTime,'{y}-{m}-{d}') : '' }}
        </template>
      </vxe-column>
      <vxe-column field="createBy" width="180" show-overflow="title" align="center" title="创建人"></vxe-column>
      <vxe-column width="180" show-overflow="title" align="center" title="操作">
        <template #default="{ row }">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(row)"
          >车型维护</el-button>
          <!-- <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(row)"
          >删除</el-button> -->
        </template>
      </vxe-column>
    </vxe-table>

    <el-dialog title="车型维护" :visible.sync="dialogVisible" width="50%">
    
    </el-dialog>
  </div>
</template>

<script>
import { getListProduct } from "@/api/mes/sales/salesPlan";
export default {
  name: 'vehicleModel',
  data() {
    return {
      productList: [],
      columnConfig: {
        drag: true,
        resizable: true,
        storage: true,
        sortConfig: {
          trigger: 'cell',
          remote: true
        },
        align: 'center',
        headerAlign: 'center'
      },
      rowConfig: {
        drag: true,
        keyField: 'id',
        isHover: true,
        isCurrent: true,
      },
    }
  },
  created(){
    this.getProductList();
  },
  methods: {
    getProductList(){
      getListProduct().then(response => {
        this.productList = response.data;
        console.log(response);
      })
    },
    handleAdd(){
      console.log('handleAdd');
    },
    cellClickEvent(row){
      console.log(row);
    },
    handleUpdate(row){
      console.log(row);
    }
  }
}
</script>

<style lang="scss" scoped>

</style>